package top.yangyitao.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name="organization")
public class Organization {
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	long id;//主键
	@Column(unique=true)
	String name;//名称
	@OneToMany(mappedBy="organization",cascade={CascadeType.REMOVE})//级联删除人员
	List<User> users;
	@OneToMany(mappedBy="organization",cascade={CascadeType.REMOVE})//级联删除商品
	List<OrganizationRole> organizationRoles;
}
